package test

import junit.framework.TestCase
import grails.spring.BeanBuilder

/**
 * Created by IntelliJ IDEA.
 * User: janexie
 * Date: 2010-11-28
 * Time: 23:58:14
 * To change this template use File | Settings | File Templates.
 */
class GORMPoweredTestCase extends TestCase{

  protected void setUp() {
    super.setUp();
    def gormEnvBeanBuilber = new BeanBuilder()
       gormEnvBeanBuilber.beans {
         xmlns gorm: "http://grails.org/schema/gorm"

         dataSource(org.apache.commons.dbcp.BasicDataSource) {
           url = "jdbc:mysql://localhost:3306/bankoffice"
           password = "root"
           username = "root"
           driverClassName = "com.mysql.jdbc.Driver"
         }

         hibernateProperties(String, """
         hibernate.show_sql=true
         hibernate.hbm2ddl.auto=update
         """)

         gorm {
           sessionFactory(
                   "base-package": "bankofficegrepper",
                   "data-source-ref": "dataSource") {
             property(name: "hibernateProperties", ref: "hibernateProperties")
           }
         }
       }
       gormEnvBeanBuilber.createApplicationContext()

  }

}
